package cn.edu.ctbu.api01.domain;


import lombok.Data;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

/**
 * 针对  tb_student1的实体类
 * **/
@Data
@Entity(name="tb_student1")
public class Student implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)  /**自增策略**/
    private Integer id;
    @NotNull
    @Size(min=10, max=10,message="学号必须是10位")
    private String no;  /**学号**/
    @NotNull
    @Size(min=2, max=20,message="姓名是2-20个字")
    private String name;  /**姓名**/
    @Size(min=6, max=6,message="密码必须是6位")
    private String password;  /**密码**/
    private Integer sex; /**性别，0未知，1男，2女**/
    @NotNull
    @Min(value = 15, message = "年龄不小于15岁")
    @Max(value = 45, message = "年龄不超过45岁")
    private Integer age;  /**年龄**/
    @NotNull
    @Min(value = 0, message = "成绩最小为0分")
    @Max(value = 100, message = "成绩不超过100分")
    private Integer score;  /**成绩**/
}
